<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Kinetis Bootloader Host: Keyblob.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Kinetis Bootloader Host
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
   <div id="projectbrief">Host Tools for Kinetis devices</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Introduction</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_keyblob_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Keyblob.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">* File: Keyblob.h</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">*</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">* Copyright (c) Freescale Semiconductor, Inc. All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">* See included license file for license details.</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">*/</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#if !defined(_Keyblob_h_)</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#define _Keyblob_h_</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;smart_ptr.h&quot;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;OptionContext.h&quot;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &quot;DataTarget.h&quot;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;AESKey.h&quot;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;AESCounter.h&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#define kKeyblobOptionNameStart &quot;start&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#define kKeyblobOptionNameEnd &quot;end&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#define kKeyblobOptionNameKey &quot;key&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#define kKeyblobOptionNameCounter &quot;counter&quot;</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceelftosb.html">elftosb</a></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;{</div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html">   27</a></span>&#160;<span class="keyword">class </span><a class="code" href="classelftosb_1_1_keyblob.html">Keyblob</a></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;{</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a43953025c808726663613a8df3cd48fa">   30</a></span>&#160;    <span class="keyword">typedef</span> std::vector&lt;OptionContext *&gt; <a class="code" href="classelftosb_1_1_keyblob.html#a43953025c808726663613a8df3cd48fa">option_vector_t</a>; </div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cf">   33</a></span>&#160;    <span class="keyword">enum</span> <a class="code" href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cf">_encryption_constants</a></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    {</div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cfa20446fcc423d9189f23634acba21b4e7">   35</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cfa20446fcc423d9189f23634acba21b4e7">k_encryptBlockSize</a> = 16, </div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cfa5ab8e7cc7dc5e8f8c9b86605dcd86c7f">   36</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cfa5ab8e7cc7dc5e8f8c9b86605dcd86c7f">k_qspiAlignlength</a> =</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;            512 </div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    };</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <a class="code" href="classelftosb_1_1_keyblob.html">Keyblob</a>()</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;        : <a class="code" href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">m_id</a>(0)</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        , <a class="code" href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">m_options</a>(0)</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    {</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    }</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="classelftosb_1_1_keyblob.html">Keyblob</a>(uint32_t identifier)</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        : <a class="code" href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">m_id</a>(identifier)</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        , <a class="code" href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">m_options</a>(0)</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    {</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    }</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classelftosb_1_1_keyblob.html">Keyblob</a>() {}</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keyword">static</span> uint32_t getKekSizeBytes() { <span class="keywordflow">return</span> <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf13f0c9b5909a104807e01b86fea9f85">kKekSizeBytes</a>; }</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="keywordtype">void</span> setIdentifier(uint32_t identifier) { <a class="code" href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">m_id</a> = identifier; }</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    uint32_t getIdentifier()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">m_id</a>; }</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a2b4bdcffe48ded76b074934350c2f01e">   57</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classelftosb_1_1_keyblob.html#a2b4bdcffe48ded76b074934350c2f01e">addOptions</a>(<a class="code" href="classelftosb_1_1_option_context.html">OptionContext</a> *context) { <a class="code" href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">m_options</a>.push_back(context); }</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a084a0e1ad4121aa213c87c896a1d4877">   59</a></span>&#160;    <span class="keyword">inline</span> option_vector_t *<a class="code" href="classelftosb_1_1_keyblob.html#a084a0e1ad4121aa213c87c896a1d4877">getOptions</a>() { <span class="keywordflow">return</span> &amp;<a class="code" href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">m_options</a>; }</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    uint8_t *<a class="code" href="classelftosb_1_1_keyblob.html#a7c42bae2bff3cab60c8255066df8adb6">createWrappedKeyblobData</a>(uint8_t *kek, uint32_t *byteCount);</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classelftosb_1_1_keyblob.html#abd04a3c6e0b27e3314aa6202b7d9eb4d">encryptMatchingRange</a>(uint32_t start, uint32_t len, uint8_t *data);</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059b">   76</a></span>&#160;    <span class="keyword">enum</span> <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059b">_keywrap_constants</a></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    {</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf602e896e1f494f2b0bfc50c7cbf0fa4">   78</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf602e896e1f494f2b0bfc50c7cbf0fa4">kKeySizeBits</a> = 128,            </div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3885bbf44457d0b27dfe215e31784b08">   79</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3885bbf44457d0b27dfe215e31784b08">kExpandedKekSizeInts</a> = 64,     </div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba81a78f8537fb9d06dd8e3ea9b42c122c">   80</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba81a78f8537fb9d06dd8e3ea9b42c122c">kNumKeyBlobs</a> = 4,              </div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059babc3816e26cdd2625d89e076747b5f812">   81</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059babc3816e26cdd2625d89e076747b5f812">kKeyBlobSizeBytes</a> = 64,        </div><div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baada6424f5b5573339d17bf1ae4217ca5">   82</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baada6424f5b5573339d17bf1ae4217ca5">kOutputLineSize</a> = 16,          </div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9ceb5746661eb39de1b5e7bdd5c4248b">   83</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9ceb5746661eb39de1b5e7bdd5c4248b">kRegionAddrMask</a> = (0x400 - 1), </div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0b880fa9654b0764635c13ba2b49ea71">   84</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0b880fa9654b0764635c13ba2b49ea71">kFlagMask</a> = 0x07,              </div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9d8bd8a554869cf7f8fe732759d91820">   85</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9d8bd8a554869cf7f8fe732759d91820">kKeyFlags</a> = 0x03,              </div><div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3ce9dea26424de982b3ebd309f364e8d">   86</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3ce9dea26424de982b3ebd309f364e8d">kAesKeySizeBytes</a> = 16,         </div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0cbb4db229b8174e9f48e6a86a21680f">   87</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0cbb4db229b8174e9f48e6a86a21680f">kCtrSizeBytes</a> = 8,             </div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf13f0c9b5909a104807e01b86fea9f85">   88</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf13f0c9b5909a104807e01b86fea9f85">kKekSizeBytes</a> = 16,            </div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf45ce87a812dd6f790c8758929b6c672">   89</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf45ce87a812dd6f790c8758929b6c672">kNumKeyChars</a> = 32,             </div><div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9716b32f5e5ebc12d2a7e732afc39801">   90</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9716b32f5e5ebc12d2a7e732afc39801">kNumCtrChars</a> = 16,             </div><div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba7115b8024c7b716b757c61a952664198">   91</a></span>&#160;        <a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba7115b8024c7b716b757c61a952664198">kCrc32SizeBytes</a> = 32           </div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    };</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="structkeyblob__t.html">   95</a></span>&#160;    <span class="keyword">typedef</span> <span class="keyword">struct </span>KeyBlob</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    {</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> key[<a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3ce9dea26424de982b3ebd309f364e8d">kAesKeySizeBytes</a>]; <span class="comment">// 16 bytes, 128-bits, KEY[A15...A00]</span></div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ctr[<a class="code" href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0cbb4db229b8174e9f48e6a86a21680f">kCtrSizeBytes</a>];    <span class="comment">// 8 bytes, 64-bits, CTR[C7...C0]</span></div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> srtaddr;                <span class="comment">// region start, STRADDR[31 - 10]</span></div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> endaddr;                <span class="comment">// region end, ENDADDR[31 - 10]</span></div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        <span class="comment">// end of 32-byte area covered by CRC</span></div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> zero_fill;      <span class="comment">// zeros</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> key_blob_crc32; <span class="comment">// crc32 over 1st 32-bytes</span></div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <span class="comment">// end of 40 byte (5*64-bit) key blob data</span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> expanded_wrap_data[8]; <span class="comment">// 8 bytes, used for wrap expanded data</span></div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        <span class="comment">// end of 48 byte (6*64-bit) wrap data</span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> unused_filler[16]; <span class="comment">// unused fill to 64 bytes</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    } <a class="code" href="structkeyblob__t.html">keyblob_t</a>;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="keywordtype">void</span> populateKeyBlob(<a class="code" href="structkeyblob__t.html">keyblob_t</a> *blob, uint32_t start, uint32_t end, <span class="keyword">const</span> <span class="keywordtype">char</span> *keyHex, <span class="keyword">const</span> <span class="keywordtype">char</span> *counterHex);</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordtype">void</span> encrypt(uint32_t length, uint8_t *data, <a class="code" href="class_a_e_s_key.html">AESKey&lt;128&gt;</a> *key, <a class="code" href="class_a_e_s_counter.html">AESCounter&lt;128&gt;</a> *counter);</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordtype">bool</span> getOptionValues(OptionContext &amp;opt, <span class="keyword">const</span> <span class="keywordtype">char</span> **key, <span class="keyword">const</span> <span class="keywordtype">char</span> **ctr, uint32_t *start, uint32_t *end);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">  114</a></span>&#160;    uint32_t <a class="code" href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">m_id</a>;             </div><div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">  115</a></span>&#160;    option_vector_t <a class="code" href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">m_options</a>; </div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;};</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;}; <span class="comment">// namespace elftosb</span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="preprocessor">#endif // _Keyblob_h_</span></div><div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba3885bbf44457d0b27dfe215e31784b08"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3885bbf44457d0b27dfe215e31784b08">elftosb::Keyblob::kExpandedKekSizeInts</a></div><div class="ttdoc">Expanded KeK size. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:79</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_abd04a3c6e0b27e3314aa6202b7d9eb4d"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#abd04a3c6e0b27e3314aa6202b7d9eb4d">elftosb::Keyblob::encryptMatchingRange</a></div><div class="ttdeci">bool encryptMatchingRange(uint32_t start, uint32_t len, uint8_t *data)</div><div class="ttdoc">Encrypt for OTFAD if range is within a keyblob entry range. </div><div class="ttdef"><b>Definition:</b> Keyblob.cpp:135</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059baf13f0c9b5909a104807e01b86fea9f85"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf13f0c9b5909a104807e01b86fea9f85">elftosb::Keyblob::kKekSizeBytes</a></div><div class="ttdoc">Number of bytes in KeK. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:88</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba9716b32f5e5ebc12d2a7e732afc39801"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9716b32f5e5ebc12d2a7e732afc39801">elftosb::Keyblob::kNumCtrChars</a></div><div class="ttdoc">Number of characters in ctr string. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:90</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba0cbb4db229b8174e9f48e6a86a21680f"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0cbb4db229b8174e9f48e6a86a21680f">elftosb::Keyblob::kCtrSizeBytes</a></div><div class="ttdoc">Number of bytes in Ctr. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:87</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059baf602e896e1f494f2b0bfc50c7cbf0fa4"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf602e896e1f494f2b0bfc50c7cbf0fa4">elftosb::Keyblob::kKeySizeBits</a></div><div class="ttdoc">AES-128. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:78</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059b"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059b">elftosb::Keyblob::_keywrap_constants</a></div><div class="ttdeci">_keywrap_constants</div><div class="ttdoc">Keywrap constants. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:76</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a562e024204c1f92de96af3ac0d4387cfa20446fcc423d9189f23634acba21b4e7"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cfa20446fcc423d9189f23634acba21b4e7">elftosb::Keyblob::k_encryptBlockSize</a></div><div class="ttdoc">Block size for AES-128 encryption. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:35</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a43953025c808726663613a8df3cd48fa"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a43953025c808726663613a8df3cd48fa">elftosb::Keyblob::option_vector_t</a></div><div class="ttdeci">std::vector&lt; OptionContext * &gt; option_vector_t</div><div class="ttdoc">List of options entries. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:30</div></div>
<div class="ttc" id="structkeyblob__t_html"><div class="ttname"><a href="structkeyblob__t.html">keyblob_t</a></div><div class="ttdoc">Key Blob format. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:95</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba0b880fa9654b0764635c13ba2b49ea71"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba0b880fa9654b0764635c13ba2b49ea71">elftosb::Keyblob::kFlagMask</a></div><div class="ttdoc">Key flags mask. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:84</div></div>
<div class="ttc" id="namespaceelftosb_html"><div class="ttname"><a href="namespaceelftosb.html">elftosb</a></div><div class="ttdef"><b>Definition:</b> BootImage.h:13</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba81a78f8537fb9d06dd8e3ea9b42c122c"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba81a78f8537fb9d06dd8e3ea9b42c122c">elftosb::Keyblob::kNumKeyBlobs</a></div><div class="ttdoc">Number of key blobs. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:80</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a562e024204c1f92de96af3ac0d4387cfa5ab8e7cc7dc5e8f8c9b86605dcd86c7f"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cfa5ab8e7cc7dc5e8f8c9b86605dcd86c7f">elftosb::Keyblob::k_qspiAlignlength</a></div><div class="ttdef"><b>Definition:</b> Keyblob.h:36</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059baf45ce87a812dd6f790c8758929b6c672"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baf45ce87a812dd6f790c8758929b6c672">elftosb::Keyblob::kNumKeyChars</a></div><div class="ttdoc">Number of characters in key string. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:89</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a2b4bdcffe48ded76b074934350c2f01e"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a2b4bdcffe48ded76b074934350c2f01e">elftosb::Keyblob::addOptions</a></div><div class="ttdeci">void addOptions(OptionContext *context)</div><div class="ttdoc">Add options. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:57</div></div>
<div class="ttc" id="classelftosb_1_1_option_context_html"><div class="ttname"><a href="classelftosb_1_1_option_context.html">elftosb::OptionContext</a></div><div class="ttdoc">Pure abstract interface class to a table of options. </div><div class="ttdef"><b>Definition:</b> apps/elftosb/common/OptionContext.h:18</div></div>
<div class="ttc" id="class_a_e_s_counter_html"><div class="ttname"><a href="class_a_e_s_counter.html">AESCounter&lt; 128 &gt;</a></div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba9d8bd8a554869cf7f8fe732759d91820"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9d8bd8a554869cf7f8fe732759d91820">elftosb::Keyblob::kKeyFlags</a></div><div class="ttdoc">Default flags: RO=0, ADE=1, VLD=1. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:85</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html"><div class="ttname"><a href="classelftosb_1_1_keyblob.html">elftosb::Keyblob</a></div><div class="ttdoc">Keyblob specification. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:27</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba7115b8024c7b716b757c61a952664198"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba7115b8024c7b716b757c61a952664198">elftosb::Keyblob::kCrc32SizeBytes</a></div><div class="ttdoc">Number of bytes covered by CRC32. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:91</div></div>
<div class="ttc" id="class_a_e_s_key_html"><div class="ttname"><a href="class_a_e_s_key.html">AESKey&lt; 128 &gt;</a></div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059baada6424f5b5573339d17bf1ae4217ca5"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059baada6424f5b5573339d17bf1ae4217ca5">elftosb::Keyblob::kOutputLineSize</a></div><div class="ttdoc">Number of bytes per output line. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:82</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba9ceb5746661eb39de1b5e7bdd5c4248b"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba9ceb5746661eb39de1b5e7bdd5c4248b">elftosb::Keyblob::kRegionAddrMask</a></div><div class="ttdoc">Region addresses are modulo 1024. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:83</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059ba3ce9dea26424de982b3ebd309f364e8d"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059ba3ce9dea26424de982b3ebd309f364e8d">elftosb::Keyblob::kAesKeySizeBytes</a></div><div class="ttdoc">Number of bytes in AES-128 key. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:86</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a7c42bae2bff3cab60c8255066df8adb6"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a7c42bae2bff3cab60c8255066df8adb6">elftosb::Keyblob::createWrappedKeyblobData</a></div><div class="ttdeci">uint8_t * createWrappedKeyblobData(uint8_t *kek, uint32_t *byteCount)</div><div class="ttdoc">Create and wrap keyblob data based on options. </div><div class="ttdef"><b>Definition:</b> Keyblob.cpp:225</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_aa19beaa30c9b5c0b4101e5f7e8c82e95"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#aa19beaa30c9b5c0b4101e5f7e8c82e95">elftosb::Keyblob::m_options</a></div><div class="ttdeci">option_vector_t m_options</div><div class="ttdoc">List of option entries. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:115</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a13f55bc127100b1864ff50130921059babc3816e26cdd2625d89e076747b5f812"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a13f55bc127100b1864ff50130921059babc3816e26cdd2625d89e076747b5f812">elftosb::Keyblob::kKeyBlobSizeBytes</a></div><div class="ttdoc">Key blob size in bytes. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:81</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a084a0e1ad4121aa213c87c896a1d4877"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a084a0e1ad4121aa213c87c896a1d4877">elftosb::Keyblob::getOptions</a></div><div class="ttdeci">option_vector_t * getOptions()</div><div class="ttdoc">Return options vector. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:59</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a95e3313480b42e32841a26604e24426a"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a95e3313480b42e32841a26604e24426a">elftosb::Keyblob::m_id</a></div><div class="ttdeci">uint32_t m_id</div><div class="ttdoc">Unique identifier. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:114</div></div>
<div class="ttc" id="classelftosb_1_1_keyblob_html_a562e024204c1f92de96af3ac0d4387cf"><div class="ttname"><a href="classelftosb_1_1_keyblob.html#a562e024204c1f92de96af3ac0d4387cf">elftosb::Keyblob::_encryption_constants</a></div><div class="ttdeci">_encryption_constants</div><div class="ttdoc">Constants for encryption. </div><div class="ttdef"><b>Definition:</b> Keyblob.h:33</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_96c2f84c885cff71a930b6845f88cdd3.html">elftosb</a></li><li class="navelem"><a class="el" href="dir_c476059e18722267e10e2fb2cca6f785.html">common</a></li><li class="navelem"><b>Keyblob.h</b></li>
    <li class="footer">Generated on Mon Mar 7 2016 16:49:50 for Kinetis Bootloader Host by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
